package org.learn.file;

import java.io.FileInputStream;
import java.io.ObjectInputStream;

public class ObjectInputStream_ {
    public static void main(String[] args) throws Exception{

        String filePath = "d:\\data.dat";

        ObjectInputStream ois  = new ObjectInputStream(new FileInputStream(filePath));


        //读取
        //读取顺序（反序列话顺序需要和你保存数据（序列化）的顺序一致）

        System.out.println(ois.readInt());
        System.out.println(ois.readBoolean());
        System.out.println(ois.readChar());
        System.out.println(ois.readObject());

        //关闭外层流即可
        ois.close();

    }
}
